package com.example.a10928.weifriend.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.a10928.weifriend.R;
import com.example.a10928.weifriend.http.api.base.MemberDetailBean;
import com.squareup.picasso.Picasso;

import java.util.List;

public class MemberAdapter extends BaseQuickAdapter<MemberDetailBean.UsersBean, BaseViewHolder> {

    String type,t;
    public MemberAdapter(int layoutResId,  List<MemberDetailBean.UsersBean> data,String type,String t) {
        super(layoutResId, data);
        this.type=type;
        this.t=t;
    }

    @Override
    protected void convert(BaseViewHolder helper, MemberDetailBean.UsersBean item) {


        if(type.equals("0")){
            helper.setText(R.id.tv_id,item.getUser_phone()+"")
                    .setText(R.id.tv_time,item.getCreated_at());
        }else{

            helper.setText(R.id.tv_id,item.getUser_id()+"")
                    .setText(R.id.tv_time,item.getCreated_at());
        }

        if(t.equals("1")){
            helper.setText(R.id.tv_id,item.getUser_phone()+"")
                    .setText(R.id.tv_time,item.getCreated_at());
        }

        if(item.getUser_auth_level()<2){
            helper.setText(R.id.tv_level,"普通会员");
        }else{
            helper.setText(R.id.tv_level,"高级会员");
        }

        Picasso.with(mContext).load(item.getUser_headimg()).into((ImageView) helper.getView(R.id.iv_header));

    }
}
